import React from 'react';
import PropTypes from "prop-types";

class Menu extends React.PureComponent{
    constructor(props) {
        super(props)
        this.handleClick = this.handleClick.bind(this);
    }

    handleClick() {
        this.props.click(this.props.menuType, this.props.title)
    }

    render() {
        const {title} = this.props;
        return (
            <li className="leftBar-menu-item" onClick={this.handleClick}>{title}</li>
        )
    }
}

Menu.propTypes = {
    menuType: PropTypes.string,
    title: PropTypes.string.isRequired,
    click: PropTypes.func.isRequired,
}

export default Menu